package com.yigang.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yigang.dao.ActivitySessionDao;

import com.yigang.entity.ActivitySession;

import com.yigang.service.ActivitySessionService;
import com.yigang.utils.ResultUtil;
@Service
@Transactional
public class ActivitySessionServiceImpl implements ActivitySessionService{

	@Autowired
	private ActivitySessionDao activitySessionDao;

	@Override
	public ResultUtil selectActivitySessionList(Integer page, Integer limit, ActivitySession record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(page, limit);
		List<ActivitySession> activitySession = activitySessionDao.selectActivitySessionList(record);
		PageInfo<ActivitySession> pageInfo = new PageInfo<ActivitySession>(activitySession);
		ResultUtil resultUtil = new ResultUtil();
		resultUtil.setCode(0);
		resultUtil.setCount(pageInfo.getTotal());
		resultUtil.setData(pageInfo.getList());
		return resultUtil;
	}

	@Override
	public ResultUtil deleteByPrimaryKey(Integer session_id) {
		// TODO Auto-generated method stub
		activitySessionDao.deleteByPrimaryKey(session_id);
		return ResultUtil.ok();
	}

	@Override
	public ResultUtil insertSelective(ActivitySession record) {
		// TODO Auto-generated method stub
		activitySessionDao.insertSelective(record);
		return ResultUtil.ok();
	}

	@Override
	public ResultUtil updateByPrimaryKeySelective(ActivitySession record) {
		// TODO Auto-generated method stub
		activitySessionDao.updateByPrimaryKeySelective(record);
		return ResultUtil.ok();
	}

	@Override
	public ActivitySession selectActivitySessionById(int session_id) {
		// TODO Auto-generated method stub
		return activitySessionDao.selectActivitySessionById(session_id);
	}

	@Override
	public ResultUtil updateActivitySessionStatusById(int session_id, int session_status) {
		// TODO Auto-generated method stub
		activitySessionDao.updateActivitySessionStatusById(session_id, session_status);
		return ResultUtil.ok();
	}

	

}
